<template>
	<view class="navBox" :style="'height:calc(94rpx + ' + statusBarHeight + 'px)'">
		<view class="navTop" :class="scrollTopNum > 25 ? 'back-set' : ''">
			<view :style="'height:' + statusBarHeight + 'px'"></view>
			<view class="navTitle">
				<slot></slot>
				<text v-if="title">{{ title }}</text>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	name: 'navTop',
	props: {
		titleColor:{
			type:String,
			default:'black'
		},
		backtitle:{
			type:String,
			default:''
		},
		showBack: {
			type: Boolean,
			default: true
		},
		backColor: {
			type: String,
			default: 'white'
		},
		needBorder: {
			type: Boolean,
			default: false
		},
		backgroundColor: {
			type: String,
			default: 'white'
		},
		title: {
			type: String,
			default: ''
		},
		scrollTopNum: {
			type: Number,
			default: 0
		}
	},
	data() {
		return {
			statusBarHeight: uni.getSystemInfoSync()['statusBarHeight'] || 20
		};
	},
	methods: {
		isBack() {
			let pages = getCurrentPages(); //获取加载的页面
			console.log('isBack', pages);
			if (pages.length <= 1) {
				uni.reLaunch({
					url: '/pages/fx_xjc/fx_xjc'
				});
				return;
			}
			uni.navigateBack({
				delta: 1,
				fail: res => {
					uni.switchTab({
						url: '/pages/fx_xjc/fx_xjc'
					});
				}
			});
		}
	},
	created() {
		
	}
};
</script>

<style lang="scss" scoped>
.isBorder {
	/* border-bottom: 1rpx solid #f2f2f2; */
}
.navBox {
	width: 100vw;
	position: relative;
}
.icon-back {
	width: 18rpx;
	height: 32rpx;
	margin-top: -5rpx;
	display: inline-block;
	vertical-align: middle;
}
.backBox {
	
	position: absolute;
	left: 0;
	top: 0;
	min-width: 100rpx;
	height: 94rpx;
	line-height: 94rpx;
	padding-left: 30rpx;
	text-align: left;
}
.navTitle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 36rpx;
	font-weight: bold;
	width: 100vw;
	height: 94rpx;
}
.navTop {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 996;
	width: 100vw;
	background: transparent;
}
.navigation-bar-actions {
	color: #fff !important;
	background: rgba(0, 0, 0, 0.13);
	box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.04);
	border: none;
}
.back-set {
	background: linear-gradient(317deg, #5E6888 0%, #303750 100%);
	box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.04);
	color: #fff;
}
</style>
